package com.project.base.baseproject.AppCustoms.Tool;

import android.content.Context;
import android.os.Looper;
import android.os.SystemClock;
import android.text.TextUtils;
import android.view.Gravity;
import android.widget.TextView;
import android.widget.Toast;

/* 用来显示一些提示信息
 * @author zou.sq
 */
public class ToastUtil {
    public static Toast toast = null;
    public static void show(final Context context, final CharSequence msg) {
        if (TextUtils.isEmpty(msg)) {
            return;
        }
        if(toast == null)
            toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT);
        TextView tv = (TextView) toast.getView().findViewById(android.R.id.message);
        if (tv != null) {
            tv.setGravity(Gravity.CENTER);
            tv.setText(msg);
        }
        toast.show();
    }
}
